1. Field of the Invention
This invention relates to a portable electronic device called an IC card having a data programmable or rewritable nonvolatile memory, and in which various control operations are performed in response to external commands.
2. Description of the Related Art
Generally, an IC card as a portable electronic device is operated based on a specification defined by ISO/IEC7816-4 which is an International Standard Specification. In ISO/IEC7816-4, access to a file such as a linear EF (Elementary File) or cyclic EF in response to a command such as a read command or record command is defined. Further, in ISO/IEC7816-4, access to each file by use of a record pointer used as pointer information is described.
In ISO/IEC7816-4, it is defined that a plurality of current states are set up by use of logical channels. However, in ISO/IEC7816-4, the operation of the record pointer for each logical channel is not defined in detail. Therefore, in the conventional IC card, data used for an authentication process cannot be held for each logical channel and data used for authentication or the like is commonly used for a plurality of logical channels.
Thus, in the conventional IC card, since the record pointer is commonly used for the logical channels, there occurs a problem that the state of the record pointer of a certain logical channel may be changed by another logical channel.
When the authentication process is performed by use of an “External Authenticate” command and “Get Challenge” command defined by ISO/IEC7816-4, Challenge data (random number data) obtained by use of the “Get Challenge” command executed in the logical channel #1 can also be used in the logical channel #2 in the conventional IC card. This means that Challenge data generated in an application 1 can also be used in an application 2 when the logical channel is allocated to each application.
Further, when Challenge data is formed in the logical channel #2 after Challenge data was formed in the logical channel #1, the Challenge data formed in the logical channel #1 may be modified into the Challenge data formed in the logical channel #2 in some cases in the conventional IC card.
Thus, since the record pointer is commonly used for the logical channels in the conventional IC card, there occurs a problem that random number data formed in a certain logical channel may be used by another logical channel or modified into random access data formed in another logical channel.